/*
 * @Author: LiuYan
 * @Date: 2022-12-20 09:31:04
 * @LastEditors: GuoShuning
 * @LastEditTime: 2022-12-23 11:03:13
 * @Description: 子传父
 */
// 子传父
export const childMessage = (param) => {
  window.parent.postMessage(param, "*");
};
// 父传子
export const parentMessage = (param) => {
  const el = document.querySelector(id);
  el.contentWindow.postMessage(param, "*");
};
// 接受参数
export const onMessage = (callback) => {
  window.addEventListener("message", (e) => {
    if (callback) callback(e.data);
  });
};